<?php
	include "database.php";

	function addData($username, $class, $student, $image, $hash) {
		$errorMessage = "Invalid Parameters";
		
		// Verify hash
		if(md5($username . "MAS4261") == $hash) {
			// Insert in to database
			import($username, $class, $student, $image);
		} else {
			/* Debug
			echo "bad hash<br/>";
			echo md5($username . "MAS4261") . "<br/>";
			echo $hash . "<br/>"; */
			die($errorMessage);
		}
		
		// Close the MySQL database connection
		mysql_close($db);
	}
?>